//
// Created by 高森森 on 2022/10/17.
//

#ifndef LEETCODE_SOLUTION_30_H
#define LEETCODE_SOLUTION_30_H
#include<bits/stdc++.h>
using namespace std;

class solution_30 {
public:
    bool isPalindrome(string s) {
        char copy[s.size()];
        int cnt=0;
        int index=0;
        while(cnt<s.size()){
            if(isalnum(s[cnt])){
                copy[index]=s[cnt];
                index++;
            }
            cnt++;
        }
        int left=0;
        int right=index-1;
        if(right<0){
            return true;
        }
        transform(copy,copy+index,copy,::tolower);
        while(left<right){
            if(copy[left]!=copy[right]){
                return false;
            }
            left++;
            right--;
        }
        return true;
    }
};


#endif //LEETCODE_SOLUTION_30_H
